package com.zxp.springsecurity.controller;

import com.zxp.springsecurity.entity.User;
import com.zxp.springsecurity.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Copyright: Copyright (c) 2022 Asiainfo
 *
 * @ClassName: com.zxp.springsecurity.controller.DemoController
 * @Description: 该类的功能描述
 * @version: v1.0.0
 * @author: 炫沙糖桔的鹏仔
 * @date: 2022/8/8 16:09
 * <p>
 * Modification History:
 * Date         Author          Version            Description
 * ------------------------------------------------------------
 * 2022/8/8      炫沙糖桔的鹏仔          v1.0.0               修改原因
 */
@RestController

public class DemoController {
    @Autowired
    UserService userService;


    @GetMapping("/hello")
    @PreAuthorize("hasAuthority('test')")
    public String hello() {
        List<User> list = userService.list();
        System.out.println(list);
        return "hello";
    }
}
